<?php
/*
+ ---------------------------------------------------------------------- +
| e107Shop - An e-commerce plugin for the e107 content management system |
|                                                                        |
| ByOrder Europe 2007-2008                                               |
| http://e107shop.com                                                    |
| patrick@byorder.nl                                                     |
|                                                                        |
| Released under the terms and conditions of the LGPL                    |
|                                                                        |
| $Revision: 1.0                                                         |
| $Date: 2008/08/20                                                      |
| $Author: Bieleke                                                       |
+ ---------------------------------------------------------------------- +
*/

function e107shop_call_function($function_name, $theorder, $thestatus, 
$theOnumber, $thegateway, $theregion, $coupon, $called) {
    global $e107shop_db_name, $tp;
    $sql = new db;
    //
    // Strip the variables from the function
    //
    $function_name_stripped=preg_replace("[\((.*?)\)]", "", $function_name);

    $function_name_stripped = $tp->toDB($function_name_stripped)."()";
    $sql->db_Select($e107shop_db_name['custom'], "*", "r_type=1 and r_name='".$function_name_stripped."'");
    while($row=$sql->db_Fetch())
    {
        if($called!=1)
        {
            eval($row["content"]);
        }
        eval($function_name.";");        
    }
    
}

function e107shop_display_custom_page_info($page_name, $pos) {
    global $e107shop_db_name, $ns, $sql, $tp;
    //
    // Remove ".php" from the page name
    //
    $page_name = str_replace(".php", "", $page_name);
    $page_name = $tp->toDB($page_name);
    $pos       = $tp->toDB($pos);
    $sql->db_Select($e107shop_db_name['custom'], "*", "r_type=2 and r_name='".$page_name."'");
    while($row=$sql->db_Fetch())
    {
        if($pos==$row["position"])
        {
            $ns->tablerender($row["title"], $tp->toHTML($row["content"]));
        }
    }
}
    
